#include "func.h"

void search(link *head)
{
    char ch[2];
    char name[20];
    printf("\033c"); //清屏
here:
    printf("请输入要搜索的联系人姓名:  ");
    scanf("%s", name);
    link *tmp = find(head, name);
    if (tmp != NULL)
    {
        printf("联系人编号：%d\n", tmp->p.id);
        printf("联系人姓名：%s\n", tmp->p.name);
        printf("联系人年龄：%d\n", tmp->p.age);
        printf("联系人电话：%s\n", tmp->p.tel);
        printf("联系人地址：%s\n", tmp->p.addr);
        printf("-----------------------\n");
        printf("是否要继续搜索联系人？(y/n)");
        scanf("%s", ch);
        if (my_strcmp(ch, "Y") == 0 || my_strcmp(ch, "y") == 0)
        {
            goto here;
        }
        else
        {
            return;
        }
    }
    else
    {
        return ;
    }
}